package com.java.clients;

import com.java.param.PageParam;
import com.java.param.ProductHotParam;
import com.java.pojo.Category;
import com.java.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient("category-service")
public interface CategoryClient {
    //当类调用这个方法的话，就会自动调用声明服务下的这个路径
    @GetMapping("/category/promo/{categoryName}")
    R byName(@PathVariable String categoryName);

    @PostMapping("/category/hots")
    R hots(@RequestBody ProductHotParam productHotParam);

    @GetMapping("/category/list")
    R list();

    @GetMapping("/category/product/list")
    List<Category> productList();

    @PostMapping("/category/admin/list")
    R adminList(@RequestBody PageParam pageParam);

    @PostMapping("/category/admin/save")
    R adminSave(@RequestBody Category category);

    @PostMapping("/category/admin/remove")
    R adminRemove(@RequestBody Category category);

    @PostMapping("/category/admin/update")
    R adminUpdate(@RequestBody Category category);

}
